// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

pub mod binauthz_management_service_v_1 {
    use crate::Result;

    /// A builder for [BinauthzManagementServiceV1][crate::client::BinauthzManagementServiceV1].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_binaryauthorization_v1::*;
    /// # use builder::binauthz_management_service_v_1::ClientBuilder;
    /// # use client::BinauthzManagementServiceV1;
    /// let builder : ClientBuilder = BinauthzManagementServiceV1::builder();
    /// let client = builder
    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::BinauthzManagementServiceV1;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = BinauthzManagementServiceV1;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::BinauthzManagementServiceV1] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [BinauthzManagementServiceV1::get_policy][crate::client::BinauthzManagementServiceV1::get_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::binauthz_management_service_v_1::GetPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetPolicy(RequestBuilder<crate::model::GetPolicyRequest>);

    impl GetPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetPolicyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Policy> {
            (*self.0.stub)
                .get_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetPolicyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [BinauthzManagementServiceV1::update_policy][crate::client::BinauthzManagementServiceV1::update_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::binauthz_management_service_v_1::UpdatePolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdatePolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdatePolicy(RequestBuilder<crate::model::UpdatePolicyRequest>);

    impl UpdatePolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdatePolicyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Policy> {
            (*self.0.stub)
                .update_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [policy][crate::model::UpdatePolicyRequest::policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Policy>,
        {
            self.0.request.policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [policy][crate::model::UpdatePolicyRequest::policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Policy>,
        {
            self.0.request.policy = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdatePolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [BinauthzManagementServiceV1::create_attestor][crate::client::BinauthzManagementServiceV1::create_attestor] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::binauthz_management_service_v_1::CreateAttestor;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateAttestor {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateAttestor(RequestBuilder<crate::model::CreateAttestorRequest>);

    impl CreateAttestor {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateAttestorRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Attestor> {
            (*self.0.stub)
                .create_attestor(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::CreateAttestorRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [attestor_id][crate::model::CreateAttestorRequest::attestor_id].
        ///
        /// This is a **required** field for requests.
        pub fn set_attestor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.attestor_id = v.into();
            self
        }

        /// Sets the value of [attestor][crate::model::CreateAttestorRequest::attestor].
        ///
        /// This is a **required** field for requests.
        pub fn set_attestor<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Attestor>,
        {
            self.0.request.attestor = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [attestor][crate::model::CreateAttestorRequest::attestor].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Attestor>,
        {
            self.0.request.attestor = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateAttestor {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [BinauthzManagementServiceV1::get_attestor][crate::client::BinauthzManagementServiceV1::get_attestor] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::binauthz_management_service_v_1::GetAttestor;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetAttestor {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetAttestor(RequestBuilder<crate::model::GetAttestorRequest>);

    impl GetAttestor {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetAttestorRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Attestor> {
            (*self.0.stub)
                .get_attestor(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetAttestorRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetAttestor {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [BinauthzManagementServiceV1::update_attestor][crate::client::BinauthzManagementServiceV1::update_attestor] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::binauthz_management_service_v_1::UpdateAttestor;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateAttestor {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateAttestor(RequestBuilder<crate::model::UpdateAttestorRequest>);

    impl UpdateAttestor {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateAttestorRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Attestor> {
            (*self.0.stub)
                .update_attestor(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
        ///
        /// This is a **required** field for requests.
        pub fn set_attestor<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Attestor>,
        {
            self.0.request.attestor = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Attestor>,
        {
            self.0.request.attestor = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateAttestor {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [BinauthzManagementServiceV1::list_attestors][crate::client::BinauthzManagementServiceV1::list_attestors] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::binauthz_management_service_v_1::ListAttestors;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListAttestors {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListAttestors(RequestBuilder<crate::model::ListAttestorsRequest>);

    impl ListAttestors {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListAttestorsRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListAttestorsResponse> {
            (*self.0.stub)
                .list_attestors(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListAttestorsResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<crate::model::ListAttestorsResponse, gax::error::Error>
        {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListAttestorsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListAttestorsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListAttestorsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListAttestors {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [BinauthzManagementServiceV1::delete_attestor][crate::client::BinauthzManagementServiceV1::delete_attestor] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::binauthz_management_service_v_1::DeleteAttestor;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteAttestor {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteAttestor(RequestBuilder<crate::model::DeleteAttestorRequest>);

    impl DeleteAttestor {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteAttestorRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .delete_attestor(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::DeleteAttestorRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteAttestor {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}

pub mod system_policy_v_1 {
    use crate::Result;

    /// A builder for [SystemPolicyV1][crate::client::SystemPolicyV1].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_binaryauthorization_v1::*;
    /// # use builder::system_policy_v_1::ClientBuilder;
    /// # use client::SystemPolicyV1;
    /// let builder : ClientBuilder = SystemPolicyV1::builder();
    /// let client = builder
    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::SystemPolicyV1;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = SystemPolicyV1;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::SystemPolicyV1] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [SystemPolicyV1::get_system_policy][crate::client::SystemPolicyV1::get_system_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::system_policy_v_1::GetSystemPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetSystemPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetSystemPolicy(RequestBuilder<crate::model::GetSystemPolicyRequest>);

    impl GetSystemPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetSystemPolicyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Policy> {
            (*self.0.stub)
                .get_system_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetSystemPolicyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetSystemPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}

pub mod validation_helper_v_1 {
    use crate::Result;

    /// A builder for [ValidationHelperV1][crate::client::ValidationHelperV1].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_binaryauthorization_v1::*;
    /// # use builder::validation_helper_v_1::ClientBuilder;
    /// # use client::ValidationHelperV1;
    /// let builder : ClientBuilder = ValidationHelperV1::builder();
    /// let client = builder
    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::ValidationHelperV1;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = ValidationHelperV1;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::ValidationHelperV1] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [ValidationHelperV1::validate_attestation_occurrence][crate::client::ValidationHelperV1::validate_attestation_occurrence] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_binaryauthorization_v1::builder;
    /// use builder::validation_helper_v_1::ValidateAttestationOccurrence;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ValidateAttestationOccurrence {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ValidateAttestationOccurrence(
        RequestBuilder<crate::model::ValidateAttestationOccurrenceRequest>,
    );

    impl ValidateAttestationOccurrence {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ValidateAttestationOccurrenceRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ValidateAttestationOccurrenceResponse> {
            (*self.0.stub)
                .validate_attestation_occurrence(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [attestor][crate::model::ValidateAttestationOccurrenceRequest::attestor].
        ///
        /// This is a **required** field for requests.
        pub fn set_attestor<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.attestor = v.into();
            self
        }

        /// Sets the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
        ///
        /// This is a **required** field for requests.
        pub fn set_attestation<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<grafeas::model::AttestationOccurrence>,
        {
            self.0.request.attestation = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<grafeas::model::AttestationOccurrence>,
        {
            self.0.request.attestation = v.map(|x| x.into());
            self
        }

        /// Sets the value of [occurrence_note][crate::model::ValidateAttestationOccurrenceRequest::occurrence_note].
        ///
        /// This is a **required** field for requests.
        pub fn set_occurrence_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.occurrence_note = v.into();
            self
        }

        /// Sets the value of [occurrence_resource_uri][crate::model::ValidateAttestationOccurrenceRequest::occurrence_resource_uri].
        ///
        /// This is a **required** field for requests.
        pub fn set_occurrence_resource_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.occurrence_resource_uri = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ValidateAttestationOccurrence {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}
